
/**
 * 选择飞行路线飞行
 */

import * as THREE from '../threejs/build/three.module.js';
import { TWEEN } from '../threejs/js/libs/tween.module.min.js';
import { Fly } from './Fly.js';
import { createMsg } from './Msg.js';
import { createDialog } from './Dialog.js';

let FlyPlay = function () {

    let showList = true;

    this.config = function (modelData, fly) {
        modelData.flies.forEach((item, index) => {
            $("#selectFly").append('<li value="' + index + '">' + item.name + '</li>');
        });

        $('#selectFly li').click(function () {
            $('#selectFly').slideToggle(350);
            var index = this.value;
            $("#auto-play").removeClass("active")
            fly.fly(modelData.flies[index].paths);
        });

        $('#auto-play').on('click', function () {
            $(this).toggleClass("active");
            $('#selectFly').slideToggle(350);
            if (showList) {
                showList = false;

            } else {

                showList = true;
            }
        });

        $('#stop').on('click', function () {
            fly.stop();
        });
    }

}

FlyPlay.prototype.constructor = FlyPlay;

export { FlyPlay }


